if ($('#priv').val() == 'Owner') {
	$("#gridDanhSachNhanVien").jqGrid({        
	   	url:'/quanlythuchi/json/?func=getListThuChi',
		datatype: "json",
	   	colNames:['id','Ngày', 'Số tiền', 'Ghi chú', 'Nhân viên', 'Trạng thái'],
	   	colModel:[
	   		{name:'id',index:'id', width:55, hidden:true},
	   		{name:'ngay',index:'ngay', width:90, editable:false},
	   		{name:'soTien',index:'soTien', width:90, editable:true},
	   		{name:'ghiChu',index:'ghiChu', width:90, editable:true},
	   		{name:'nhanVien',index:'nhanVien', width:90, editable:false},
	   		{name:'trangThai',index:'trangThai', width:90, editable:true, edittype:"select", editoptions:{value: "Duyet:Duyệt; Chua duyet: Chưa duyệt; Xoa: Xóa"}},
	   	],
	   	rowNum:10,
	   	rowList:[10,20,30],
	   	pager: '#pDanhSachNhanVien',
	   	sortname: 'id',
	    viewrecords: true,
	    loadonce: false,
	    sortorder: "desc",
		jsonReader: {
			repeatitems : false,
			id: "0"
		},
		caption: "Quản lý thu chi",
		width: '971',
	    height: '100%',
		editurl:"/quanlythuchi/json/?func=updateThuChi"
	});
	jQuery("#gridDanhSachNhanVien").jqGrid('navGrid','#pDanhSachNhanVien',
										{
											edit:true,
											add:true,
											del:false
										});
}
else {
	$("#gridDanhSachNhanVien").jqGrid({        
	   	url:'/quanlythuchi/json/?func=getListThuChi',
		datatype: "json",
	   	colNames:['id','Ngày', 'Số tiền', 'Ghi chú', 'Nhân viên', 'Trạng thái'],
	   	colModel:[
	   		{name:'id',index:'id', width:55, hidden:true},
	   		{name:'ngay',index:'ngay', width:90, editable:false},
	   		{name:'soTien',index:'soTien', width:90, editable:true},
	   		{name:'ghiChu',index:'ghiChu', width:90, editable:true},
	   		{name:'nhanVien',index:'nhanVien', width:90, editable:false},
	   		{name:'trangThai',index:'trangThai', width:90, editable:false, edittype:"select", editoptions:{value: "Duyet:Duyệt; Chua duyet: Chưa duyệt; Xoa: Xóa"}},
	   	],
	   	rowNum:10,
	   	rowList:[10,20,30],
	   	pager: '#pDanhSachNhanVien',
	   	sortname: 'id',
	    viewrecords: true,
	    loadonce: false,
	    sortorder: "desc",
		jsonReader: {
			repeatitems : false,
			id: "0"
		},
		caption: "Quản lý thu chi",
		width: '971',
	    height: '100%',
		editurl:"/quanlythuchi/json/?func=updateThuChi"
	});
	jQuery("#gridDanhSachNhanVien").jqGrid('navGrid','#pDanhSachNhanVien',
										{
											edit:false,
											add:true,
											del:false
										});
}

$(document).ready(function() {
	$('#search').click(function() {
		$("#gridDanhSachNhanVien")
			.jqGrid()
			.setGridParam({url : '/quanlythuchi/json/?func=getListThuChi'
				+'&tuNgay=' + $('#tuNgay').val()
				+'&denNgay=' + $('#denNgay').val()
				})
				.trigger('reloadGrid');
	});
	
	$('#KeToan').addClass('Active');
	$('#tuNgay').datepicker({ dateFormat: "dd/mm/yy" });
	$('#denNgay').datepicker({ dateFormat: "dd/mm/yy" });
});